<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<%@ taglib prefix="s" uri="/struts-tags" %>
<%@ taglib prefix="sj" uri="/struts-jquery-tags"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<sj:head/>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>EVON Global Logistics Solution</title>
<SCRIPT type="text/javascript">
function fnCallSection() {
	document.forms["sectionForm"].action = 'manageAllKeyBins';
	document.forms["sectionForm"].submit(); 
}

function fnCallAllSection() {
	document.forms["sectionForm"].action = 'manageAllSections';
	document.forms["sectionForm"].submit(); 
}
</SCRIPT>
<link href="css/style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="js/jquery-1.8.3.min.js"></script>
<script type="text/javascript" src="js/functionality.js"></script>
</head>
 
<body onload="hideall()">
<sj:div id="sectionDiv" name="sectionDiv" cssClass="maincontent"
	indicator="indicator">
<s:form action="addSectionAction" name="sectionForm" id = "sectionForm" theme="simple" validate="true">

    	
	
	<h4>
<s:actionmessage/>
<s:fielderror></s:fielderror>
</h4>
<table width="99%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
		<td><b>Selected Yard :</b>
		<s:select label="Select Yard" headerKey="-1"
				headerValue="Select Yard" list="listYard" listKey="id"
				listValue="name" name="yardId" disabled="true"/>
		</td>
		</tr>
		</table>
	<br/>
	<table width="99%" border="0" align="center" cellpadding="4" cellspacing="1" class="gridtable">
	
		<tr>
		<th colspan="4">Edit Details</th>
		</tr>
		
		<tr class="alt"> 
		<td>Section Name</td>
		<td><s:textfield name="sectionDTO.sectionName"  value="%{sectionDTO.sectionName}" /></td>
		<td>Permanent</td>
		<td><s:checkbox name= "sectionDTO.permanent"  value="%{sectionDTO.permanent}"></s:checkbox></td>
		</tr>
		<tr class="alt"> 
		<td>Active</td>
		<td> <s:checkbox name= "sectionDTO.active"  value="%{sectionDTO.active}"></s:checkbox></td>
		<td>Slot#</td>
		<td> <s:textfield name="sectionDTO.capacity" value="%{sectionDTO.capacity}" /></td>
		</tr>
		</table>
		<table width="99%" border="0" align="center" cellpadding="0" cellspacing="0">
		<tr>
		<td style="height:10px;"></td>
		</tr>
		<tr>
		
		<td align="right">
					<s:url var="submitSectionUrl" action="addSectionAction" >
					<s:param name="yardId" value="%{yardId}"/></s:url>
				<sj:submit href="%{submitSectionUrl}"  targets="sectionDiv" formIds="sectionForm" cssClass="btnbg" />
				
				</td>
				
				<td align="right">
					<s:url var="addPsUrl" action="addPsAction" ></s:url>
				<sj:submit href="%{addPsUrl}"  targets="sectionDiv" formIds="sectionForm" cssClass="btnbg" value="Add Parking Slot" />
				
				</td>
		</tr>
		</table>
				
			<table border="1" width="100%" >
  <tr bgcolor="#038040" >
  <td>
  Parking Slot Number
  </td>
  <td>
  Parking Slot Name
  </td>
  <td>
  Active
 
  </td>
  <td>
  Priority Order

  </td>
  <td>
  Occupied
 
  </td>
  </tr>
<s:hidden id ="sectionDTO.sectionId" name="sectionDTO.sectionId" value="%{sectionDTO.sectionId}"></s:hidden>
<s:iterator value="listParkingSlots" id="listParkingSlots" status="pSlot">
 <tr>
 <s:hidden   name = "listParkingSlots[%{#pSlot.index}].id"  value ="%{id}"></s:hidden>
</tr>
  <tr >
  <td>
  
  <s:textfield   name = "listParkingSlots[%{#pSlot.index}].slotNumber"  value ="%{slotNumber}"></s:textfield>
  </td>
  
  <td>
  
  <s:textfield   name = "listParkingSlots[%{#pSlot.index}].slotName"  value ="%{slotName}" onchange="alert('%{slotName}')"></s:textfield>
  </td>
  <td>
  <s:checkbox  name= "listParkingSlots[%{#pSlot.index}].active" value ="%{active}"></s:checkbox>
  </td>
  <td>
  <s:textfield  name= "listParkingSlots[%{#pSlot.index}].priority"  size="5" value ="%{priority}" ></s:textfield>
  </td>
  <td>
  <s:checkbox name= "listParkingSlots[%{#pSlot.index}].occupied" value ="%{occupied}"></s:checkbox>
  </td>
  </tr>
  </s:iterator>
  
  

  
  </table><!--
  <s:submit action="addParkingSlotAction" cssClass="btnbg"/>
			
	--><s:url var="submitParkingUrl" action="addParkingSlotAction" ></s:url>
				<sj:submit href="%{submitParkingUrl}"  targets="sectionDiv" formIds="sectionForm" cssClass="btnbg" />
	
	<!--
		<s:a  href="exportPsToExcel.action" disabled="%{isSectionNotSelected}">Export</s:a>
	
--><s:url action="exportPsToExcel" id="secId" >
   <s:param name="sectionId" value="%{sectionDTO.sectionId}"/>
  </s:url>
  
  <s:a href="%{secId}" >Export</s:a>






   	 		<s:file name="parkingSlotUploadFile" label="ParkingSlots" theme="simple" value="Section File" disabled="%{isSectionNotSelected}"/>
   	 	
    		<sj:submit href = "parkingSlotUpload.action" value="UploadParkingSlot" name = "UploadParkingSlot" formIds="sectionForm" targets="sectionDiv" disabled="%{isSectionNotSelected}"/>
   
    <td align="right">
					<s:url var="backUrl" action="manageAllSections" escapeAmp="false">
					<s:param name="selectedYardId" value="%{yardId}"/>
					<s:param name="oemType" value="%{oemId}"/></s:url>
				<sj:submit href="%{backUrl}"  targets="sectionDiv" formIds="sectionForm" cssClass="btnbg" value="Back" />
				
				</td>	
 
</s:form> 
</sj:div>
</body>
</html>